package com.hqd.utils.file.filter;

import com.hqd.utils.file.SimpleFileUtils;
import org.apache.commons.lang3.StringUtils;

import java.io.FileFilter;

/**
 * 后缀过滤器
 */
public class SuffixNameFilter implements FileFilter {

    private String suffixName;

    public SuffixNameFilter(String suffixName) {
        this.suffixName = suffixName;
    }

    @Override
    public boolean accept(java.io.File pathname) {
        if (StringUtils.equalsIgnoreCase(SimpleFileUtils.getFileSuffix(pathname), suffixName)) {
            return true;
        }
        return false;
    }

}
